<?php

namespace App\Service\Activity;

use App\Helpers\AliyunUtil;
use App\Model\Act\WishTree;
use App\Model\Act\WishTreeGift;
use App\Model\Gift;
use App\Service\BaseService;

/**
 * 许愿树规则
 */
class WishTreeRulesService extends BaseService
{
    public function handle()
    {
        $list = WishTreeGift::getConf();
        $giftInfo = Gift::getBatchInfo(array_column($list, 'gift_id'));
        $giftList = [];
        foreach ($giftInfo as $giftItem) {
            $giftList[] = [
                'gift_name' => $giftItem['name'],
                'coin' => (string)$giftItem['coin'],
                'gift_icon' => AliyunUtil::imageResize(AliyunUtil::IMG_HOST_V2 . $giftItem['icon'], 120, 120),
            ];
        }
        $ret = [
            'gift_list' => $giftList,
            'rules' => "
1、每向许愿树许愿，可获得一个礼物愿望，每收集1个礼物需消耗20金币;

2、“愿望”礼物可在个人背包中查看，可赠送给心动对象，对象可获得金币分成(不增加收礼者的魅力值);

3、背包礼物只能通过参与平台活动的方式获取，不可直接购买;
        
4、背包礼物不可直接兑换现金，也不可私下交易，谨防上当受骗;

5、本活动最终解释权归本平台所有;"
        ];
        return $ret;
    }
}
